package com.javacoo.xservice.base.utils;

import com.javacoo.xservice.base.support.swaparea.SwapAreaUtils;

import lombok.extern.slf4j.Slf4j;

/**
 * 日志工具类
 * <li></li>
 *
 * @author: duanyong@jccfc.com
 * @since: 2021/3/17 17:28
 */
@Slf4j
public class LogUtil {
    private static final String TS = "[{}]";
    /**
     * 打印info级别日志
     * <li></li>
     * @author duanyong@jccfc.com
     * @date 2021/3/17 17:39
     * @param format:格式化字符串
     * @param argArray:参数数组
     * @return: void
     */
    public static final void info(String format, Object... argArray) {
        log.info(TS+format, SwapAreaUtils.getSwapAreaData().getTransactionSn(),argArray);
    }
    /**
     * 打印info级别日志
     * <li></li>
     * @author duanyong@jccfc.com
     * @date 2021/3/18 9:10
     * @param msg:消息
     * @return: void
     */
    public static final void info(String msg) {
        log.info(TS+msg, SwapAreaUtils.getSwapAreaData().getTransactionSn());
    }
    /**
     * 打印info级别日志
     * <li></li>
     * @author duanyong@jccfc.com
     * @date 2021/3/18 9:15
     * @param msg:消息
     * @param t: 异常
     * @return: void
     */
    public static final void info(String msg, Throwable t) {
        log.info("["+SwapAreaUtils.getSwapAreaData().getTransactionSn()+"]"+msg,t);
    }
    /**
     * 打印error级别日志
     * <li></li>
     * @author duanyong@jccfc.com
     * @date 2021/3/18 9:08
     * @param format:格式化字符串
     * @param argArray:参数数组
     * @return: void
     */
    public static final void error(String format, Object... argArray) {
        log.error(TS+format, SwapAreaUtils.getSwapAreaData().getTransactionSn(),argArray);
    }
    /**
     * 打印error级别日志
     * <li></li>
     * @author duanyong@jccfc.com
     * @date 2021/3/18 9:11
     * @param msg:消息
     * @return: void
     */
    public static final void error(String msg) {
        log.error(TS+msg, SwapAreaUtils.getSwapAreaData().getTransactionSn());
    }
    /**
     * 打印error级别日志
     * <li></li>
     * @author duanyong@jccfc.com
     * @date 2021/3/18 9:21
     * @param msg: 消息
     * @param t: 异常
     * @return: void
     */
    public static final void error(String msg, Throwable t) {
        log.error("["+SwapAreaUtils.getSwapAreaData().getTransactionSn()+"]"+msg,t);
    }
    /**
     * 打印warn级别日志
     * <li></li>
     * @author duanyong@jccfc.com
     * @date 2021/3/18 9:24
     * @param format:格式化字符串
     * @param argArray:参数数组
     * @return: void
     */
    public static final void warn(String format, Object... argArray) {
        log.warn(TS+format, SwapAreaUtils.getSwapAreaData().getTransactionSn(),argArray);
    }
    /**
     * 打印warn级别日志
     * <li></li>
     * @author duanyong@jccfc.com
     * @date 2021/3/18 9:25
     * @param msg: 消息
     * @return: void
     */
    public static final void warn(String msg) {
        log.warn(TS+msg, SwapAreaUtils.getSwapAreaData().getTransactionSn());
    }
    /**
     * 打印warn级别日志
     * <li></li>
     * @author duanyong@jccfc.com
     * @date 2021/3/18 9:25
     * @param msg:消息
     * @param t:异常
     * @return: void
     */
    public static final void warn(String msg, Throwable t) {
        log.warn("["+SwapAreaUtils.getSwapAreaData().getTransactionSn()+"]"+msg,t);
    }
    /**
     * 打印trace级别日志
     * <li></li>
     * @author duanyong@jccfc.com
     * @date 2021/3/18 9:25
     * @param format:格式化字符串
     * @param argArray:参数数组
     * @return: void
     */
    public static final void trace(String format, Object... argArray) {
        log.trace(TS+format, SwapAreaUtils.getSwapAreaData().getTransactionSn(),argArray);
    }
    /**
     * 打印trace级别日志
     * <li></li>
     * @author duanyong@jccfc.com
     * @date 2021/3/18 9:34
     * @param msg: 消息
     * @return: void
     */
    public static final void trace(String msg) {
        log.trace(TS+msg, SwapAreaUtils.getSwapAreaData().getTransactionSn());
    }
    /**
     * 打印trace级别日志
     * <li></li>
     * @author duanyong@jccfc.com
     * @date 2021/3/18 9:35
     * @param msg: 消息
     * @param t: 异常
     * @return: void
     */
    public static final void trace(String msg, Throwable t) {
        log.trace("["+SwapAreaUtils.getSwapAreaData().getTransactionSn()+"]"+msg,t);
    }
    /**
     * 打印debug级别日志
     * <li></li>
     * @author duanyong@jccfc.com
     * @date 2021/3/18 9:34
     * @param format:格式化字符串
     * @param argArray:参数数组
     * @return: void
     */
    public static final void debug(String format, Object... argArray) {
        log.debug(TS+format, SwapAreaUtils.getSwapAreaData().getTransactionSn(),argArray);
    }
    /**
     * 打印debug级别日志
     * <li></li>
     * @author duanyong@jccfc.com
     * @date 2021/3/18 9:35
     * @param msg: 消息
     * @return: void
     */
    public static final void debug(String msg) {
        log.debug(TS+msg, SwapAreaUtils.getSwapAreaData().getTransactionSn());
    }
    /**
     * 打印debug级别日志
     * <li></li>
     * @author duanyong@jccfc.com
     * @date 2021/3/18 9:35
     * @param msg:消息
     * @param t:异常
     * @return: void
     */
    public static final void debug(String msg, Throwable t) {
        log.debug("["+SwapAreaUtils.getSwapAreaData().getTransactionSn()+"]"+msg,t);
    }
}
